// import Cookies from 'js-cookie'
import { getSetting } from '@/api/common'

const state = {
  primaryColor: '#409EFF',
  settingList: {}
}

const mutations = {
  SET_SETTING: (state, settingList) => {
    state.settingList = settingList
  },
}

const actions = {
  // 获取网站配置信息
  getSetting({ commit }, data) {
    return new Promise((resolve, reject) => {
      getSetting(data).then(response => {
        commit('SET_SETTING', response.setting_value_list)
        resolve()
      }).catch(error => {
        reject(error)
      })
    })
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
